package com.ccp.dev.form.model;

import com.ccp.dev.core.basic.model.BaseModel;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;

/**
 * bpm_form_def Model对象
 *
 * @author zhaowj
 */
@SuppressWarnings("serial")
@XmlRootElement(name = "FormDef")
@XmlAccessorType(XmlAccessType.NONE)
public class FormDef extends BaseModel implements Cloneable{

    /**
     * 在同一个页面中编辑
     */
    public static final String EDIT_INLINE = "2";

    /**
     * 在窗口中编辑
     */
    public static final String EDIT_FORM = "1";

    /**
     * 设计类型：通过表生成
     */
    public static final int DESIGN_TYPE_FROM_TABLE = 0;

    /**
     * 设计类型：自定义
     */
    public static final int DESIGN_TYPE_CUSTOM_DESIGN = 1;

    /**
     * 在窗口中编辑
     */
    public static final String EDIT_WINDOW = "window";

    /**
     * 分页
     */
    public static String PageSplitor = "#page#";

    /**
     * 不是默认版本
     */
    public static final Short IS_NOT_DEFAULT = 0;

    /**
     * 是默认版本
     */
    public static final Short IS_DEFAULT = 1;

    /**
     * 未发布
     */
    public static final Short IS_NOT_PUBLISHED = 0;

    /**
     * 发布
     */
    public static final Short IS_PUBLISHED = 1;

    /**
     * 公开
     */
    public static final Short IS_PUBLIC = 1;

    /**
     * 不公开
     */
    public static final Short IS_NOT_PUBLIC = 0;


    /**
     * 默认版本号
     */
    public static final int VERSION_NO_DEFAULT = 1;

    /**
     * 表单ID
     */
    @XmlAttribute
    protected String formDefId;

    /**
     * key
     */
    @XmlAttribute
    protected String formKey = "";

    /**
     * 表单分类
     */
    @XmlAttribute
    protected String categoryId;

    /**
     * 表单分类名称
     */
    protected String typeName = "";

    /**
     * 表单名称
     */
    @XmlAttribute
    protected String subject = "";

    /**
     * 描述
     */
    @XmlAttribute
    protected String formDesc = "";

    /**
     * 表单标题
     */
    @XmlAttribute
    protected String title = "";

    /**
     * 子表选择的显示列和编辑列json信息
     */
    @XmlAttribute
    protected String subTemplateField;

    /**
     * tab选项卡标题
     */
    @XmlAttribute
    protected String tabTitle = "";

    /**
     * 定义html
     */
    @XmlAttribute
    protected String html;

    /**
     * freemarker模板
     */
    @XmlAttribute
    protected String template;

    /**
     * 是否缺省
     */
    @XmlAttribute
    protected Short isDefault = IS_NOT_DEFAULT;

    /**
     * 对应tableId
     */
    @XmlAttribute
    protected String tableId;

    /**
     * 版本号
     */
    @XmlAttribute
    protected Integer versionNo;

    /**
     * 是否发布
     */
    @XmlAttribute
    protected Short isPublished = IS_NOT_PUBLISHED;

    /**
     * 发布人
     */
    protected String publishedBy;

    /**
     * 发布时间
     */
    protected java.util.Date publishTime;

    /**
     * 表名
     */
    protected String tableName;

    /**
     * 设计类型(0,通过表生成，1，通过表单设计)
     */
    @XmlAttribute
    protected int designType = DESIGN_TYPE_FROM_TABLE;

    /**
     * 是否主表
     */
    protected Short isMain = 0;

    /**
     * 模板表对应id
     */
    protected String templatesId;

    /**
     * 是否公开
     */
    @XmlAttribute
    protected Short isPublic = IS_PUBLIC;

    /**
     * 租户
     */
    @XmlAttribute
    protected String tenant;

    /**
     * 创建人
     */
    @XmlAttribute
    protected String creator;

    /**
     * 版本数量
     */
    protected Integer versionCount;

    /**
     * 数据模板数量
     */
    protected Integer dataTemplateCount;

    public Integer getDataTemplateCount() {
        return dataTemplateCount;
    }

    public void setDataTemplateCount(Integer dataTemplateCount) {
        this.dataTemplateCount = dataTemplateCount;
    }

    public String getFormDefId() {
        return formDefId;
    }

    public void setFormDefId(String formDefId) {
        this.formDefId = formDefId;
    }

    public String getFormKey() {
        return formKey;
    }

    public void setFormKey(String formKey) {
        this.formKey = formKey;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getFormDesc() {
        return formDesc;
    }

    public void setFormDesc(String formDesc) {
        this.formDesc = formDesc;
    }

    public String getSubTemplateField() {
        return subTemplateField;
    }

    public void setSubTemplateField(String subTemplateField) {
        this.subTemplateField = subTemplateField;
    }

    public String getTabTitle() {
        return tabTitle;
    }

    public void setTabTitle(String tabTitle) {
        this.tabTitle = tabTitle;
    }

    public String getHtml() {
        return html;
    }

    public void setHtml(String html) {
        this.html = html;
    }

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public Short getIsDefault() {
        return isDefault;
    }

    public void setIsDefault(Short isDefault) {
        this.isDefault = isDefault;
    }

    public String getTableId() {
        return tableId;
    }

    public void setTableId(String tableId) {
        this.tableId = tableId;
    }

    public Integer getVersionNo() {
        return versionNo;
    }

    public void setVersionNo(Integer versionNo) {
        this.versionNo = versionNo;
    }

    public Short getIsPublished() {
        return isPublished;
    }

    public void setIsPublished(Short isPublished) {
        this.isPublished = isPublished;
    }

    public String getPublishedBy() {
        return publishedBy;
    }

    public void setPublishedBy(String publishedBy) {
        this.publishedBy = publishedBy;
    }

    public Date getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public int getDesignType() {
        return designType;
    }

    public void setDesignType(int designType) {
        this.designType = designType;
    }

    public Short getIsMain() {
        return isMain;
    }

    public void setIsMain(Short isMain) {
        this.isMain = isMain;
    }

    public String getTemplatesId() {
        return templatesId;
    }

    public void setTemplatesId(String templatesId) {
        this.templatesId = templatesId;
    }

    public Short getIsPublic() {
        return isPublic;
    }

    public void setIsPublic(Short isPublic) {
        this.isPublic = isPublic;
    }

    public String getTenant() {
        return tenant;
    }

    public void setTenant(String tenant) {
        this.tenant = tenant;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getVersionCount() {
        return versionCount;
    }

    public void setVersionCount(Integer versionCount) {
        this.versionCount = versionCount;
    }

    @Override
    public String toString() {
        return "FormDef{" +
                "formDefId='" + formDefId + '\'' +
                ", formKey='" + formKey + '\'' +
                ", categoryId=" + categoryId +
                ", typeName='" + typeName + '\'' +
                ", subject='" + subject + '\'' +
                ", formDesc='" + formDesc + '\'' +
                ", subTemplateField='" + subTemplateField + '\'' +
                ", tabTitle='" + tabTitle + '\'' +
                ", html='" + html + '\'' +
                ", template='" + template + '\'' +
                ", isDefault=" + isDefault +
                ", tableId='" + tableId + '\'' +
                ", versionNo=" + versionNo +
                ", isPublished=" + isPublished +
                ", publishedBy='" + publishedBy + '\'' +
                ", publishTime=" + publishTime +
                ", tableName='" + tableName + '\'' +
                ", designType=" + designType +
                ", isMain=" + isMain +
                ", templatesId='" + templatesId + '\'' +
                ", isPublic=" + isPublic +
                ", tenant='" + tenant + '\'' +
                ", title='" + title + '\'' +
                ", creator='" + creator + '\'' +
                '}';
    }

}

